<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php
echo JhtraqHelper::drawTabs($this->project->slug);
$milestone = $this->milestone;
?>
<p></p>
<div class="componentheading">
	<?php echo $this->project->name; ?> - <?php echo JText::_('Milestone');?> <?php echo (!empty($milestone['codename']))?'<small>'.$milestone['codename'].'</small>':'';?>
</div>

<div class="milestone">
	<div class="info">
	<p class="date">
		<?php if($milestone['due'] == 0 && $milestone['completed'] == 0) { ?>
		<?php } elseif($milestone['completed'] > 0) { ?>
			<?php echo JhtraqHelper::l('completed_on_x',date("d/m/Y",$project['completed']))?>
		<?php } elseif($milestone['due'] <= time()) { ?>
			<?php echo JhtraqHelper::l('due_x_ago',JhtraqHelper::timesince($milestone['due'],true))?>
		<?php } elseif($milestone['due'] > time()) { ?>
			<?php echo JhtraqHelper::l('due_x_from_now',JhtraqHelper::timefrom($milestone['due'],true))?>
		<?php } ?>
	</p>
	<table>
		<tr>
			<td>
			<table class="progress" cellspacing="0">
				<tr>
				<?php if($milestone['tickets']['percent']['closed'] != 0) { ?>
					<td class="closed" width="<?php echo $milestone['tickets']['percent']['closed']?>%">
						<a href="<?php echo JRoute::_('index.php?option=com_jhtraq&view=tickets&project='.$this->project->slug.'&filter[milestone_id]='.$milestone['id'])?>"></a>
					</td>
				<?php } ?>
				<?php if($milestone['tickets']['percent']['open'] != 0) { ?>
					<td class="open" width="<?php echo $milestone['tickets']['percent']['open']?>%"><a href="<?php echo JRoute::_('index.php?option=com_jhtraq&project='.$this->project->slug.'&view=tickets&filter[milestone_id]='.$milestone['id'])?>"></a>
					</td>
				<?php } ?>
				</tr>
				</table>
			</td>
			<td class="percent"><?php echo $milestone['tickets']['percent']['closed']?>%</td>
		</tr>
	</table>
<dl>
<dt><?php echo JText::_('Closed Tickets')?>:</dt>
<dd><a href="<?php echo JRoute::_('index.php?option=com_jhtraq&project='.$this->project->slug.'&view=tickets&filter[milestone_id]='.$milestone['id'])?>"><?php echo $milestone['tickets']['closed']?></a></dd>
<dt><?php echo JText::_('Active Tickets')?>:</dt>
<dd><a href="<?php echo JRoute::_('index.php?option=com_jhtraq&project='.$this->project->slug.'&view=tickets&filter[milestone_id]='.$milestone['id'])?>"><?php echo $milestone['tickets']['open']?></a></dd>
<dt><?php echo JText::_('total_tickets')?>:</dt>
<dd><a href="<?php echo JRoute::_('index.php?option=com_jhtraq&project='.$this->project->slug.'&view=tickets&filter[milestone_id]='.$milestone['id'])?>"><?php echo $milestone['tickets']['total']?></a></dd>
</dl>
<?php echo $milestone['info']?>
</div>
</div>